package com.cskaoyan.day02.doubled;

import com.cskaoyan.day02.single.MyLinkedList;

/**
 * @author stone
 * @date 2022/01/28 09:55
 */
public class LinkedListDemo {

    public static void main(String[] args) {
        LinkedList myLinkedList = new LinkedList();
        myLinkedList.add(null);//node.value=null
        myLinkedList.add("红");
        myLinkedList.add("橙");
        myLinkedList.add("黄");
        System.out.println(myLinkedList.size());
        //红-->橙-->黄-->
        myLinkedList.show();
        myLinkedList.remove(null);
        //红-->橙-->黄-->
        myLinkedList.show();
        myLinkedList.remove("黄");
        //红-->橙-->
        myLinkedList.show();

        myLinkedList.add(0, "黑");
        myLinkedList.add(2, "白");
        //黑-->红-->白-->橙-->
        myLinkedList.show();

        System.out.println(myLinkedList.remove(2));
        myLinkedList.show();

        myLinkedList.set(1, "心想事橙");
        System.out.println(myLinkedList.get(1));

        System.out.println(myLinkedList.contains("橙"));
        System.out.println(myLinkedList.contains("白"));

        myLinkedList.show();
        myLinkedList.set("橙", "happynewyear");
        myLinkedList.show();
    }
}
